import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
import tagRoute from './tagRoute'
import userRoute from './userRoute'
import SystemRoute from './systemRoute'

const commonRouters: Array<RouteRecordRaw> = [
  {
    path:"/login",
    name:"Login",
    component: () => import(/* webpackChunkName: "about" */ '@/views/login/login.vue')
  },
  {
    path: '/',
    redirect:'/index',
    component: () => import(/* webpackChunkName: "Index" */ '@/views/layout/layout.vue'),
    children:[
      {
        path: '/index',
        name: 'index',
        meta:{
          title:'首页',
          name:"首页"
        },
        component: () => import( /* webpackChunkName: "home" */ '@/views/home/Home.vue'),
      },
      {
        path: '/userInfo',
        name: 'userInfo',
        meta:{
          title:'用户信息',
          name:"用户信息"
        },
        component: () => import( /* webpackChunkName: "home" */ '@/views/home/userInfo.vue'),
      }
    ]
  },
  
]


export const allRoute = [
  ...tagRoute,
  ...userRoute,
  ...SystemRoute
]


const router = createRouter({
  history: createWebHashHistory(),
  routes:[
    ...tagRoute,
    ...userRoute,
    ...SystemRoute,
    ...commonRouters
  ]
})

export default router
